﻿<UserControl x:Class="Yamaha.AVControl.Desktop.Controls.SelectorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\Styles\DefaultTheme.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <ScrollViewer VerticalScrollBarVisibility="Auto">
        <ItemsControl x:Name="icSelectables" ItemsSource="{Binding}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Click="Button_Click" Tag="{Binding}" Margin="10" Padding="10" Width="100">
                        <Button.Style>
                            <Style TargetType="Button" BasedOn="{StaticResource DefaultButton}">
                                <Setter Property="Foreground" Value="{StaticResource SelectionTextForeground}" />
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Foreground" Value="{StaticResource SelectionTextForegroundHover}" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
                            <Image Source="{Binding ImageUri}" Height="48" Width="48" />
                            <TextBlock Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=Foreground}"
                                       TextWrapping="Wrap"
                                Text="{Binding DisplayName}" FontWeight="Bold" FontSize="16">
                            </TextBlock>
                        </StackPanel>
                    </Button>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </ScrollViewer>
</UserControl>
